using System;
using System.Diagnostics;

namespace MvvmFx.Common.Helpers
{
    /// <summary>
    /// Helper utility methods for common event and delegate functions
    /// </summary>
    public static class EventDelegateHelper
    {
        [Conditional("DEBUG")]
        public static void CheckInvocationList(EventHandler handler)
        {
            Delegate[] delegates = handler.GetInvocationList();
            Debug.WriteLine(delegates.Length);
            foreach (Delegate del in delegates)
            {
                Debug.WriteLine(del.Target);
            }
        }

        [Conditional("DEBUG")]
        public static void CountInvocationList(EventHandler handler)
        {
            Delegate[] delegates = handler.GetInvocationList();
            Debug.WriteLine("Count: " + delegates.Length);
        }

    }
}